<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"  %>
<!DOCTYPE html>

<head>
    <meta charset="utf-8">
    <!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
    <title>大乱斗后台</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta name="viewport" content="width=device-width">
    <link href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    <link href="http://cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/dld/admin/css/template_main.css">
</head>

<body>
	<jsp:include page="../common/header.jsp"></jsp:include>
        <!--/.navbar-collapse -->
        <div class="templatemo-content-wrapper">
            <div class="templatemo-content">
				<form class="form-horizontal"action="adminAddSubmitGoodsMngAction" method="post">
				  <div class="form-group">
				    <label for="name" class="col-sm-2 control-label">名字</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="name" name="goodsEdit.name">
				      <div class="alert alert-danger name-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="content" class="col-sm-2 control-label">内容</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="content" name="goodsEdit.content">
				      <div class="alert alert-danger content-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="hp" class="col-sm-2 control-label">生命加成</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="hp" name="goodsEdit.hp">
				      <div class="alert alert-danger hp-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="ap" class="col-sm-2 control-label">法强加成</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="ap" name="goodsEdit.ap">
				      <div class="alert alert-danger ap-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="ad" class="col-sm-2 control-label">攻击加成</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="ad" name="goodsEdit.ad">
				      <div class="alert alert-danger ad-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="hj" class="col-sm-2 control-label">护甲加成</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="hj" name="goodsEdit.hj">
				      <div class="alert alert-danger hj-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="ll" class="col-sm-2 control-label">力量加成</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="ll" name="goodsEdit.ll">
				      <div class="alert alert-danger ll-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="mj" class="col-sm-2 control-label">敏捷加成</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="mj" name="goodsEdit.mj">
				      <div class="alert alert-danger mj-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="zl" class="col-sm-2 control-label">智力加成</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" id="zl" name="goodsEdit.zl">
				      <div class="alert alert-danger zl-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="other" class="col-sm-2 control-label">其他加成</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="other" name="goodsEdit.other">
				      <div class="alert alert-danger other-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="type" class="col-sm-2 control-label">装备类型</label>
				    <div class="col-sm-10">
	                    <label class="radio-inline">
		                    <input type="radio" id="type" value="wq" name="goodsEdit.type"> 武器
	                    </label>
	                    <label class="radio-inline">
		                    <input type="radio" id="type" value="yf" name="goodsEdit.type"> 衣服
	                    </label>
	                    <label class="radio-inline">
		                    <input type="radio" id="type" value="sp" name="goodsEdit.type"> 饰品
	                    </label>
				    </div>
				    <div class="alert alert-danger type-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				  </div>
				  
				  <div class="form-group">
				    <div class="col-sm-offset-2 col-sm-10">
				      <div onclick="submit()" class="btn btn-default">添加</div>
				      <button class="btn btn-warning" onclick="history.go(-1)">取消</button>
				    </div>
				  </div>
				</form>
            </div>
        </div>
	<jsp:include page="../common/footer.jsp"></jsp:include>
    <script src="http://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="/dld/admin/js/template_js.js"></script>
    <script>
    function submit(){
        if($('#name').val().length <= 0 || $('#name').val().length >= 10){
        	$('.name-msg').show();
        	$('.name-msg').text('请输入0位到10位的名称！');
        	return;
        }else{
        	$('.name-msg').hide();
        }
        if($('#content').val() == ''){
        	$('.content-msg').show();
        	$('.content-msg').text('不能为空！');
        	return;
        }else{
        	$('.content-msg').hide();
        }
        if ($('#hp').val() < 0 || $('#hp').val().length >10) {
        	$('.hp-msg').show();
        	$('.hp-msg').text('必须大于等于0且不能超过10位！');
            return;
        }else{
        	$('.hp-msg').hide();
        }
        if($('#ap').val() < 0 || $('#ap').val().length >10){
        	$('.ap-msg').show();
        	$('.ap-msg').text('必须大于等于0且不能超过10位！');
        	return;
        }else{
        	$('.ap-msg').hide();
        }
        if($('#ad').val() < 0 || $('#ad').val().length >10){
        	$('.ad-msg').show();
        	$('.ad-msg').text('必须大于等于0且不能超过10位！');
        	return;
        }else{
        	$('.ad-msg').hide();
        }
        if($('#ll').val() < 0 || $('#ll').val().length >10){
        	$('.ll-msg').show();
        	$('.ll-msg').text('必须大于等于0且不能超过10位！');
        	return;
        }else{
        	$('.ll-msg').hide();
        }
        if($('#mj').val() < 0 || $('#mj').val().length >10){
        	$('.mj-msg').show();
        	$('.mj-msg').text('必须大于等于0且不能超过10位！');
        	return;
        }else{
        	$('.mj-msg').hide();
        }
        if($('#zl').val() < 0 || $('#zl').val().length >10){
        	$('.zl-msg').show();
        	$('.zl-msg').text('必须大于等于0且不能超过10位！');
        	return;
        }else{
        	$('.zl-msg').hide();
        }
        if($('#type').val() < 0){
        	$('.type-msg').show();
        	$('.type-msg').text('请选择装备类型！');
        	return;
        }else{
        	$('.type-msg').hide();
        }
    	$('.form-horizontal').submit();
    }
    </script>
</body>

</html>